package com.fish.start.animation.global;

import java.lang.ref.SoftReference;
import java.util.HashMap;
import java.util.Map;

import com.fish.start.animation.Attr.AbstractWay;

public class Global {
	private static Global mGlobal;
	private Map<String, SoftReference<AbstractWay>> 
		lastAnimations = new HashMap<String, SoftReference<AbstractWay>>();
	private Global(){}
	public static Global getInstance(){
		if(mGlobal==null){
			mGlobal = new Global();
		}
		return mGlobal;
	}
	public void putLastAinmation(AbstractWay aAnimationAttr){
		lastAnimations.put(aAnimationAttr.getClass().getSimpleName(),new SoftReference(aAnimationAttr));
	}
	public AbstractWay getLastAnimationByClassName(String classSimpleName){
		if(lastAnimations.containsKey(classSimpleName)){
			return lastAnimations.get(classSimpleName).get();
		}
		return null;
	}
}
